package com.dalin.platform.loa.action;

import java.io.File;
import java.util.List;

import com.dalin.common.utils.ExcelUtils;
import com.dalin.framework.action.StrutsTwoAction;
import com.dalin.platform.loa.service.LoaService;

/*****************************************************************************
 * @content: 导入学生信息excel                                                 *
 * @author : 那建林                                                                                                                                 *
 * @crtDate: 2010-12-13 16:56:54                                            *
 ****************************************************************************/
public class UserImportAction extends StrutsTwoAction {
	private LoaService loaService; // 
	private File excelFile;// 上传的文件
	
	public String execute() throws Exception {
		try {
			Long projectId = getCurrentUser().getProjectId();
			List<List<String>> dataList = ExcelUtils.readAll(excelFile, 0);
			dataList = loaService.addLoaUsers(projectId, dataList);
			exportExcel(dataList, "sheet1", "errorData");
		} catch(Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	
	
	
	/*************************************************************************
	 * 以下是bean属性的set/get方法
	 */

	public File getExcelFile() {
		return excelFile;
	}

	public void setExcelFile(File excelFile) {
		this.excelFile = excelFile;
	}

	public LoaService getLoaService() {
		return loaService;
	}

	public void setLoaService(LoaService loaService) {
		this.loaService = loaService;
	}
}
